#coding=utf-8
from django.db import models
from django.contrib.auth.models import User
LIMIT_CHOICES = (
               (u"管理员", u"管理员"),
               (u"子账户", u"子账户"),
               )

# 以后会搁一些分组信息比如加入字段：宿舍，职务等等 方便拓展
class Organization(models.Model):
    name = models.CharField(max_length=128)
    val = models.CharField(max_length=128)
    def __unicode__(self):
        return self.name

# 用户的基本信息
class UserProfile(models.Model):
    user = models.OneToOneField(User)
    name = models.CharField(max_length=32)
    student_num = models.CharField(max_length=16, null=True)
    celphone_num = models.CharField(max_length=16, null=True)
    qq = models.CharField(max_length=16, null=True)
    msn = models.CharField(max_length=128, null=True)
    address = models.CharField(max_length=128, null=True)
    company = models.CharField(max_length=128, null=True)
    remarks = models.TextField()
    limit = models.CharField(max_length=16, choices=LIMIT_CHOICES)
    last_login_time = models.DateTimeField()
    created_time = models.DateTimeField()
    nickname = models.CharField(max_length=32, null=True)
    
    def __unicode__(self):
        return self.user.username

#昵称系统
class NickName(models.Model):
    user = models.ForeignKey(User)
    click_times = models.IntegerField()
    given_by = models.CharField(max_length=32)
    given_time = models.DateTimeField()
    name = models.CharField(max_length=32)
